package books.borrowing.endpoints;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import books.borrowing.entity.BookBorrowingEntity;
import books.borrowing.services.BookBorrowingService;

@Service("bookBorrowingServiceEndpoint")
@WebService(serviceName="BookBorrowingService")
public class BookBorrowingServiceEndpoint {

	@Autowired
	private BookBorrowingService bookBorrowingService;

	@WebMethod
	public void save(BookBorrowingEntity _rent) throws Exception {
		bookBorrowingService.save(_rent);
	}

	@WebMethod
	public void update(BookBorrowingEntity _rent) {
		bookBorrowingService.update(_rent);
	}

	@WebMethod
	public void delete(BookBorrowingEntity _rent) {
		bookBorrowingService.delete(_rent);
	}

	@WebMethod
	public BookBorrowingEntity rentBook(String _login, String _ISBN)
			throws Exception {
		return bookBorrowingService.rentBook(_login, _ISBN);
	}

	@WebMethod
	public BookBorrowingEntity returnBook(String _login, String _ISBN) {
		return bookBorrowingService.returnBook(_login, _ISBN);
	}

	@WebMethod
	public List<BookBorrowingEntity> findRent(String _login, String _ISBN) {
		return bookBorrowingService.findRent(_login, _ISBN);
	}
	
	@WebMethod
	public List<BookBorrowingEntity> findSubscriberRents(String _login) {
		return bookBorrowingService.findSubscriberRents(_login);
	}
}
